<script setup>
import { ref } from 'vue'
import {formatDate} from '@/utils'
import { userBatchDetails } from '@/api'
import { toRaw } from '@vue/reactivity'
import { Search } from '@element-plus/icons-vue'

const dateTypeList = [
  {
  'name':'已送达'
},
  {
  'name':'发送失败'
},
]
const searchVal = ref('')
const searchStaff = ()=>{
  console.log('搜索客户')
}
const tableData = ref()
const pageNo = ref(1)
const queryForm = ref({
	qrId: ''
})
const isRefresh = ref(true)
const handleRefresh = () => {
  isRefresh.value = false
  isRefresh.value = true
}
const total = ref(0)
const show = async(id)=>{
	console.log('asdasdasd')
	userBatchDetails({ staffid: id }).then((res) => {
		tableData.value = res.data.customer
		total.value = res.data.all_count

	})
	
}
const emits = defineEmits(['showDetail'])
defineExpose({
	show
})

</script>
<template>
	<div>
			<div class="app-gap-block-top">
			<el-card>

			<div class="">
        <div class="">
				
				
          <span class="app-words-2 app-flex-left"
					><span style="font-size:18px;font-weight:600">客户列表</span><span class="weak-grey-font app-gap-words-left">|</span>
					<span class="app-gap-words-left">共{{ total }}个客户</span>
        </span>
				<el-table class="app-gap-block-top" :data="tableData" style="width: 100%">
							<el-table-column prop="name" label="全部客户" width="180" >
							<template #default="scope">
								<div class="app-flex-left">
							<el-avatar class="cho-margin" shape="square" :size="50" :src="scope.row.avatar" />
							<div class="app-gap-words-left">
							<div class="">
								<span class="">
									{{ scope.row.name}}
								
								</span>
								</div>
							
							</div>
						</div>
						</template>
							</el-table-column>
							<el-table-column prop="name" label="标签" width="180">
								<template #default="scope">
									<el-tag v-for="item in scope.row.tags" style="margin-left: 3px">{{ item }}</el-tag>
								</template>
							</el-table-column>
							<el-table-column prop="createtime" label="添加时间" />
							<el-table-column prop="address" label="操作">
								<template #default="scope">
									<el-button type="primary" text @click="emits('showDetail',scope.row.id)">详情</el-button>
								</template>
							</el-table-column>
						</el-table>
        

      </div>
      </div>
			</el-card>
		</div>
	</div>
</template>
<style lang="scss">
@import url('../../../../style/app-component.scss');
.el-page-header {
  display:none;
}
</style>
